$(document).ready(function(){
	$("#btn_rekap").click(function(){
		var tglAwal=$("#tgl_awal").val();
		var tglAkhir=$("#tgl_akhir").val();

		$.post('controller/cont.rekap.php',{aksi_rekap:true,tglAwal:tglAwal,tglAkhir:tglAkhir},function(data){
			$("#list_cuti tbody").html("");
			var tab="";
			if(data.msg){
				$.each(data.cuti, function(index, cuti) {
					tab += "<tr>";
	                tab += "<td>" + cuti.cuti.nip + "</td>";
	                tab += "<td>" + cuti.pegawai.nama + "</td>";
	                tab += "<td>" + cuti.cuti.tglAwal + " s.d. " + cuti.cuti.tglAkhir + "</td>";
	                tab += "<td>" + cuti.ref + "</td>";
	                tab += "<td>" + cuti.cuti.jmlHari + "</td>";
	                tab += "<td> Kontak :" + cuti.cuti.telp + "</td>";
	                tab += "</tr>";
	            });
			}else{
				tab += "<tr>"
	            tab += "<td>Data Tidak Ada</td>";
	            tab += "</tr>";
			}
			$('#list_cuti tbody').append(tab);
			return false;
		},'json');
		return false;
	});
	
});